<template>
	<view class="bg">
		<view class="search_view">
			<u-search placeholder="请输入关键词" v-model="keyword" @change='searchList' :show-action='false'></u-search>
		</view>
		<view class="info" v-for="(item, index) in dataArr" :key="index">
			<view class="info_item_header">
				<view>{{ item.itemCode_dictText }}</view>
			</view>
			<view class="info_item">
				<view>问题描述</view>
				<view>{{ item.questionDescribe }}</view>
			</view>
			<view class="info_item">
				<view>分管领导</view>
				<view>{{ item.itemLeader }}</view>
			</view>
			<view class="info_item">
				<view>单位</view>
				<view>{{ item.departments_dictText }}</view>
			</view>
			<view class="info_item">
				<view>状态</view>
				<view>{{ item.questionStatus_dictText }}</view>
			</view>
		</view>
		<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText"></u-loadmore>
		<u-back-top :scroll-top="scrollTop"></u-back-top>
	</view>
</template>

<script>
	import {
		homeTqxtList
	} from "@/request/zdxm.js"
	export default {
		data() {
			return {
				keyword: '',
				scrollTop: 0,
				nowPage: 1,
				status: 'loadmore',
				dataArr: [],
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
			};
		},
		onLoad() {
			this.homeTqxtList()
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		onReachBottom() {
			this.status = 'loading';
			this.nowPage++
			this.homeTqxtList()
		},
		methods: {
			searchList(){
				this.dataArr = []
				this.nowPage = 1
				this.homeTqxtList()
			},
			homeTqxtList() {
				homeTqxtList({
					searchWord: this.keyword,
					pageNo: this.nowPage,
					pageSize: '10',
					column: 'createTime',
					order: 'desc'
				}).then((res) => {
					this.dataArr = [...this.dataArr, ...res.data.result.records]
					if (res.data.result.records.length < 10) {
						this.status = 'nomore'
					}
				})
			},
			toDetail() {
				uni.navigateTo({
					url: "/pages/zdxm/tqxt/detail/index",
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.search_view{
		padding: 20rpx 24rpx;
		background: #ffffff;
		box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(48, 116, 255, 0.1);
		border-radius: 8rpx;
		margin-bottom: 30rpx;
	}
	.info {
		width: 710rpx;
		margin: 0 auto;
		background: #ffffff;
		box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(48, 116, 255, 0.1);
		border-radius: 8rpx;
		padding: 0 24rpx;
		margin-bottom: 30rpx;

		.info_item_header {
			// height: 100rpx;
			// line-height: 100rpx;
			padding: 30rpx 0;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #272b32;
			border-bottom: 1rpx solid rgba(231, 233, 240, 1);
		}

		.info_item {
			display: flex;
			flex-flow: row nowrap;
			justify-content: flex-start;
			align-items: center;
			padding: 26rpx 0;

			view:nth-child(1) {
				width: 150rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #8e9cb3;
			}

			view:nth-child(2) {
				flex: 1;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #272b32;
				margin-left: 20rpx;
			}

			.detail {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #3074ff;
			}
		}

		.info_item:last-child {
			padding-top: 30rpx;
			margin-top: 10rpx;
			border-top: 1rpx solid rgba(231, 233, 240, 1);
		}
	}
</style>
